/*设置全局引用*/
define(function() {
    function defaultStr() {
        return 'http://115.29.136.190:8080/help';
    }

    function checkUser() {
        return $.ajax({
            type: "GET",
            url: "http://115.29.136.190:8080/help/usr/user/getUserStatus.do" + "?" + document.cookie,
            contentType: "application/json; charset=utf-8",
            dataType: 'json',
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
        }).done(
            handleSessionTimeOut
        );
    }

    function handleSessionTimeOut(data) {
        if (data && data.retcode === '202') {
            location.reload();
        }
    }

    function arrayToStr(items) {
        var id = '';
        var len = items.length;
        for (i in items) {
            if (i === len - 1) {
                id = id + items[i];
            } else {
                id = id + items[i] + ',';
            }
        }
        return id;
    }
    return {
        defaultStr,
        arrayToStr,
        checkUser
    };
});
